![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@travetto/config
Advanced tools
The config module provides support for loading application config on startup. Configuration values support all valid yaml
constructs.
Config loading follows a defined resolution path:
node_modules/@travetto/<module>/config/*.yml
config/*.yml
process.env.PROFILE
, process.env.ENV
or passed in as command line arguments.process.env.PROFILE=<val1>,<val2>...
or
process.env.ENV=<val1>,<val2>...
would load
profile/<val1>.yml
profile/<val2>.yml
Additionally you can achieve the above state by invoking the app with parameters:
$ npm start <val1> <val2>
process.env
to allow for overriding any values. Because we are overriding ayaml
based configuration we need to compensate for the differences in usage patterns. Generally all environment variables are passed in as UPPER_SNAKE_CASE
. When reading from process.env
we will map UPPER_SNAKE_CASE
to upper.snake.case
, and will attempt to match by case-insensitive name.A more complete example setup would look like:
config/database.yml
database:
host: localhost
port: 9423
creds:
user: test
password: test
profile/prod.yml
database:
host: prod-host-db
creds:
user: admin-user
with environment variables
PROFILE=prod
DATABASE_PORT=1234
DATABASE_CREDS_PASSWORD=<secret>
At runtime the resolved config would be:
database:
host: prod-host-db
port: 1234
creds:
user: admin-user
password: <secret>
The module provides a decorator, @Config
that allows for classes to automatically be bound with config information on post construction. The decorator will install a postConstruct
method if not already defined, that allows actually performs the binding of configuration.
The decorator takes in a namespace, of what part of the resolved configuration you want to bind to your class. Given the following class
@Config('database')
class DBConfig {
private host: string;
private port: number;
private creds = {
user: '',
password: ''
};
}
And the corresponding config file
database:
host: localhost
port: 9423
creds:
user: bob
password: bobspw
The instance of DBConfig
would be equivalent to:
{
host: 'localhost',
port: 9423,
creds : {
user: 'bob',
password: 'bobspw'
}
}
FAQs
Configuration support
The npm package @travetto/config receives a total of 373 weekly downloads. As such, @travetto/config popularity was classified as not popular.
We found that @travetto/config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.